package com.example.yuejianapp14.Activity.Adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.yuejianapp14.Activity.Activity.TieziInfoActivity;
import com.example.yuejianapp14.Activity.JavaBean.Coachask;
import com.example.yuejianapp14.Activity.JavaBean.Tiezi;
import com.example.yuejianapp14.R;
import com.squareup.picasso.Picasso;

import java.util.List;

/**
 * Created by 张森 on 2017/11/10.
 */

public class CoachskAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    private Context mContext;
    private List<Coachask> mDataList;
    private LayoutInflater mLayoutInflater;

    public CoachskAdapter(Context mContext, List mDataList) {
        this.mContext = mContext;
        this.mDataList = mDataList;
        mLayoutInflater = LayoutInflater.from(mContext);

    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v=mLayoutInflater.from(parent.getContext()).inflate(R.layout.coachaskcard,parent,false);
        return new ViewHolder(v);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        final Coachask entity = (Coachask) mDataList.get(position);
        if (null == entity)
            return;
        CoachskAdapter.ViewHolder viewHolder = (CoachskAdapter.ViewHolder) holder;
        viewHolder.user_name.setText(entity.getUname());
        viewHolder.coachname.setText(entity.getCoachname());
        viewHolder.answer.setText(entity.getAnswer());
        viewHolder.question.setText(entity.getQuestion());

        // viewHolder.news_stars.setRating(Float.parseFloat(entity.get("news_stars").toString()));
        // viewHolder.news_thumb.setIIntegemageResource(r.parseInt(entity.get("news_thumb").toString()));

    }

    @Override
    public int getItemCount() {
        return mDataList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder{
        TextView user_name,coachname,answer,question;

        public ViewHolder(View itemView) {
            super(itemView);
            user_name = (TextView) itemView.findViewById(R.id.user_name);
            coachname = (TextView) itemView.findViewById(R.id.coachname);
            answer = (TextView) itemView.findViewById(R.id.answer);
            question = (TextView) itemView.findViewById(R.id.question);
        }
    }
}
